<!doctype html>

<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">


    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <title>{% block title %} Simple site {% endblock %}</title>
  </head>
  <body >

    {%block body%}
    <header class = "header fixed-top">


      <nav class="navbar navbar-expand-lg navbar-light bg-light">
          <div class="container-fluid">
          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="true" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarResponsive">
          {% if user.is_authenticated%}
            <ul class="navbar-nav ms-auto">
              <li class="nav-item active">

                  <li class="nav-item">
                      <a class="nav-item nav-link dropdown-toggle mr-md-2" href="#" id="userMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{user.username}}</a>
                  </li>
                  <li class="nav-item">
                        <a class="btn btn-primary ml-auto"href="{% url 'logout'%}">Log out<span class="sr-only"></span></a>

                      </li>

                </ul>

              </div>
            </div>




          {%else%}
          <button type="button" class="navbar-toggler"
          data-toggle="collapse" data-target="#mainMenu" aria-controls="mainMenu" aria-expanded="false" aria-haspopup="true" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span> </button>

          <form class="form-inline ms-auto" >
            <a href="{% url 'login'%}" class="btn btn-secondary" color="white">Log in</a>
            <a href="{% url 'signup'%}" class = "btn btn-primary ml-3">Sign up</a>
          </form>
          {% endif%}

  </nav>

</header>

  <div class="container" >
  {% block content %}{% endblock %}
  </div>


      {% endblock body%}

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
  </body>
</html>
